'''
水平布局
'''

import sys
from PyQt5.QtWidgets import *

class HboxLayout(QWidget):
    def __init__(self):
        super().__init__()
        self.setWindowTitle("水平盒布局")

        hlayout=QHBoxLayout()
        hlayout.addWidget(QPushButton("按钮1"))
        hlayout.addWidget(QPushButton("按钮2"))
        hlayout.addWidget(QPushButton("按钮3"))
        hlayout.addWidget(QPushButton("按钮4"))
        hlayout.addWidget(QPushButton("按钮5"))

        hlayout.setSpacing(40)#设置控件之间的间距
        self.setLayout(hlayout)

if __name__ == '__main__':
    app = QApplication(sys.argv)
    window = HboxLayout()
    window.show()
    sys.exit(app.exec_())